/***************************************************************
 * FILENAME:  eeprom3200.h
 * AUTHOR:    zimmermane@msoe.edu <Evan Zimmerman>
 *            duerk@msoe.edu <Kevin Duer>
 * DATE:      24 Sept 2012
 * PROVIDES:  
 *    - header file for EEPROM Device Driver 
 *    - Contains subroutines and functions for EEPROM
 **************************************************************/
#ifndef EEPROM_DRIVER
#define EEPROM_DRIVER

#include <stdint.h>

// global string pointer for reading from EEPROM
// gets rewritten with each call to eeprom_read_string
static unsigned char eeStr[11];

/*
 * eeprom_read
 * Purpose: reads a byte of data from EEPROM
 * Parameters: address: address to read from (0-1023)
 * Returns: byte in EEPROM
 */
uint8_t eeprom_read(uint16_t address);

/*
 * eeprom_write
 * Purpose: writes a byte of data to EEPROM
 * Parameters: address: address to write to (0-1023)
 *             databyte: byte to write
 * Returns: none
 */
void eeprom_write(uint16_t address, uint8_t databyte);

/*
 * eeprom_read_string
 * Purpose: reads a 10 character string from EEPROM (10 successive bytes).
 *          String is returned in the global eeStr variable.
 * Parameters: address: address to read from (0-1023)
 * Returns: pointer to global string
 */
unsigned char* eeprom_read_string(uint16_t address);

/*
 * eeprom_write_string
 * Purpose: writes a 10 character string to EEPROM (10 successive bytes).
 * Parameters: address: address to write to (0-1023)
 * Returns: none
 */
void eeprom_write_string(uint16_t address, unsigned char* str);

/*
 * eeprom_clear
 * Purpose: clears all EEPROM locations
 * Parameters: none
 * Returns: none
 */
void eeprom_clear(void);

#endif
